# Contributor: Zach DeCook <zachdecook@librem.one>
# Maintainer: Zach DeCook <zachdecook@librem.one>
pkgname=hyprland
pkgver=0.34.0
pkgrel=0
_wlroots_commit="5d639394f3e83b01596dcd166a44a9a1a2583350"
_wlroots_date=20231130
pkgdesc="Highly customizable dynamic tiling Wayland compositor that doesn't sacrifice on its looks."
url="https://hyprland.org"
arch="all"
license="BSD-3-Clause"
source="
	https://github.com/hyprwm/Hyprland/archive/v$pkgver/Hyprland-v$pkgver.tar.gz
	https://gitlab.freedesktop.org/wlroots/wlroots/-/archive/$_wlroots_commit/wlroots-$_wlroots_commit.tar.gz
	use-system-installed-udis86.patch
	https://github.com/earboxer/Hyprland/commit/0906b3daa20a8e6be78ce80ab965fc06401349f2.patch
	"
builddir="$srcdir/Hyprland-$pkgver"
makedepends="
	cairo-dev
	cmake
	elogind-dev
	eudev-dev
	glslang-dev
	hwdata-dev
	hyprland-protocols
	jq
	libcap-dev
	libdisplay-info-dev
	libdrm-dev
	libinput-dev
	libliftoff-dev
	libseat-dev
	libxcb-dev
	libxkbcommon-dev
	mesa-dev
	meson
	ninja
	pango-dev
	pixman-dev
	tomlplusplus-dev
	udis86-git-dev
	vulkan-loader-dev
	wayland-dev
	wayland-protocols
	xcb-util-image-dev
	xcb-util-renderutil-dev
	xcb-util-wm-dev
	xkeyboard-config-dev
	xwayland-dev
	"
subpackages="$pkgname-doc $pkgname-dev $pkgname-wallpapers::noarch"

prepare() {
	default_prepare
	# Use downloaded wlroots (instead of git submodule)
	rmdir subprojects/wlroots
	mv "$srcdir/wlroots-$_wlroots_commit" "$builddir"/subprojects/wlroots
	# Apply upstream's patch just to change the soversion
	cd "$builddir"/subprojects/wlroots
	git apply --include=meson.build "$builddir"/subprojects/packagefiles/wlroots-meson-build.patch
	# Make the version number valid
	sed -i "s/-dev/_git$_wlroots_date/" "$builddir"/subprojects/wlroots/meson.build
}

build() {
	abuild-meson . output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	meson test --no-rebuild -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

wallpapers() {
	pkgdesc="Wallpapers for Hyprland"

	amove usr/share/hyprland/wall_*.png
}

sha512sums="
8a14aa28d16cdcbe67d04db87e523813b5377b70dc15674da9600c6f79142bdc3ec9ee14ecc11bcd0d60d77f6c48f0456f869097731a829fb393a8dfc834396d  Hyprland-v0.34.0.tar.gz
67edd83608ccac2dc39b2638bba637ed7dcc190795f9c7eab536572c6a06685fdd37c9e5fef148b128a472dd077ee8fdf5eda21f2903523ce3ca9dd82a705ea2  wlroots-5d639394f3e83b01596dcd166a44a9a1a2583350.tar.gz
d2f7b35552fa0a3e992b9050f7066d983b3b7c193a888018b2e0d6fa9e17fc3deff922fa3989d0bb79e8bd82df2bc16ff0c27a82759ad0ce2e72789506eb07db  use-system-installed-udis86.patch
5cbf6811323a48e04b316686349f5db1ca3f20460b741da45145ef6e39ebd000c0a68d52574fd8e74bc7b0f317788d805f9f4b0f66a00c7707007926b8d095ae  0906b3daa20a8e6be78ce80ab965fc06401349f2.patch
"
